package cn.acyou.leo.user.service.impl;

import cn.acyou.leo.framework.service.ServiceImpl;
import cn.acyou.leo.framework.util.RandomUtil;
import cn.acyou.leo.user.entity.Student;
import cn.acyou.leo.user.mapper.StudentMapper;
import cn.acyou.leo.user.service.StudentService;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author fangyou
 * @version [1.0.0, 2021-09-03 9:10]
 */
@Slf4j
@Service
public class StudentServiceImpl extends ServiceImpl<StudentMapper, Student> implements StudentService {

    @Override
    @Cacheable(value="leo:example:demo22#100", key="#jo + '-' + #jo2")
    public Student getById(JSONObject jo, JSONObject jo2) {
        Student student = new Student(jo.getLong("id"), RandomUtil.randomUserName(), 12, null);
        log.info("获取用户：" + student);
        return student;
    }
    @Override
    @Cacheable(value="leo:example:demo33#100", key="#jo + '-' + #jo2")
    public Student getById(JSONObject jo, List<String> jo2) {
        Student student = new Student(jo.getLong("id"), RandomUtil.randomUserName(), 12, null);
        log.info("获取用户：" + student);
        return student;
    }
}
